package com.scoresystem.dao.proxy;

import java.sql.Connection;
import java.util.List;

import com.scoresystem.dao.ICourseDao;
import com.scoresystem.dao.impl.CourseDaoImpl;
import com.scoresystem.model.Course;
import com.scoresystem.utils.JdbcUtil;

public class CourseDaoProxy implements ICourseDao {
	private ICourseDao dao;
	private Connection conn;
	
	public CourseDaoProxy()throws Exception{
		conn=JdbcUtil.getInstance().getConnection();
		dao=new CourseDaoImpl(conn);
	}
	@Override
	public boolean add(Course course) {
		boolean bool=dao.add(course);
		JdbcUtil.getInstance().free(conn);
		return bool;
	}

	@Override
	public List<String> getCoursebyTea(String worknum) {
		List<String> list;
		list=dao.getCoursebyTea(worknum);
		JdbcUtil.getInstance().free(conn);
		return list;
	}
	@Override
	public List<String> getCourses() {
		List<String> list;
		list=dao.getCourses();
		JdbcUtil.getInstance().free(conn);
		return list;
	}
	@Override
	public List<String> getCoursesbyTea(String teanum) {
		List<String> list;
		list=dao.getCoursesbyTea(teanum);
		JdbcUtil.getInstance().free(conn);
		return list;
	}

}
